package de.mariusharbeck.saralentz.web.listener;

import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

import de.mariusharbeck.saralentz.service.BildService;
import de.mariusharbeck.saralentz.service.impl.BildServiceImpl;

public class SessionListener implements HttpSessionListener {

	@Override
	public void sessionCreated(HttpSessionEvent event) {
		// Funktioniert (vermutlich) mit SpringSecurity nicht.
		// ExternalContext externalContext = FacesContext.getCurrentInstance()
		// .getExternalContext();
		// HttpServletRequest request = (HttpServletRequest) externalContext
		// .getRequest();
		//
		// Enumeration<String> headerNames = request.getHeaderNames();
		// while (headerNames.hasMoreElements()) {
		// String headerName = (String) headerNames.nextElement();
		// System.out.println(headerName + ": "
		// + request.getHeader(headerName));
		// }
		BildService bildDB = new BildServiceImpl();
		bildDB.addHit();

	}

	@Override
	public void sessionDestroyed(HttpSessionEvent event) {

	}

}
